package com.lizhi.yun.db.sfrobot.entity;


import com.lizhi.mybatis.boot.Description;
import com.lizhi.yun.db.sfrobot.common.IllnessSideType;
import com.lizhi.yun.db.sfrobot.common.RobotType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.util.List;

@Data
@ToString
@Entity
@Table(name = "his_center_assess_record")
@Description("评估记录")
public class AssessRecord extends AbstractHisEntity {

    @Id
    @Column(length = 30)
    @Description("lid")
    public String lid;


    @Description("记录id")
    public String id;

    @Column
    @Description("医师id")
    public String doctorId;

    /**
     * 患病侧
     */
    @Column
    @Description("患侧")
    public int illnessSide;

    @Description("患侧")
    @Transient
    public String illnessSideText;

    /**
     * 医师账号
     */
    @Column(length = 20)
    @Description("医师账号")
    public String doctorAccount;

    /**
     * 医师姓名
     */
    @Column(length = 20)
    @Description("医师姓名")
    public String doctorName;

    @Column
    @Description("患者id")
    public String patientId;

    /**
     * 患者姓名
     */
    @Column(length = 20)
    @Description("患者姓名")
    public String patientName;

    /**
     * 患者编号
     */
    @Column(length = 30)
    @Description("患者编号")
    public String patientNo;

    /**
     * 患者手机号
     */
    @Column
    @Description("患者手机号")
    public String patientPhone;

    @Column
    @Description("上下肢机器类型")
    public Integer robotType;

    @Description("上下肢机器人类型")
    @Transient
    public String robotTypeText;

    @Column(length = 20)
    @Description("创建时间")
    public String createTime;

    /*云管需要的数据*/
    @ApiModelProperty(value = "医院ID")
    private String hospitalId;

    @ApiModelProperty(value = "系统ID")
    private String hospitalSystemId;

    @Description("评估详细信息")
    @Transient
    private List<AssessTable> assessTables;

    public String getIllnessSideText() {
        if (IllnessSideType.SideBoth.getEnValue() == this.illnessSide){
            this.illnessSideText = IllnessSideType.SideBoth.getEnName();
        } else if (IllnessSideType.SideLeft.getEnValue() == this.illnessSide){
            this.illnessSideText = IllnessSideType.SideLeft.getEnName();
        } else if (IllnessSideType.SideRight.getEnValue() == this.illnessSide){
            this.illnessSideText = IllnessSideType.SideRight.getEnName();
        }
        return illnessSideText;
    }

    public String getRobotTypeText() {
        if (RobotType.UpperLimb.getEnValue().equals(this.robotType)){
            this.robotTypeText = RobotType.UpperLimb.getEnName();
        } else if (RobotType.LowerLimb.getEnValue().equals(this.robotType)){
            this.robotTypeText = RobotType.LowerLimb.getEnName();
        }
        return robotTypeText;
    }
}
